#ifndef GY_GRAPHICSCORNERSTYLERECT_H
#define GY_GRAPHICSCORNERSTYLERECT_H

#include "Graphics/BasicGraphics/GY_BasicsGraphicsObject.h"
#include "Graphics/GY_Object.h"
#include "GY_ControlLibrary_global.h"
#include <QGraphicsPathItem>
#include <QPointF>
#include <QPainter>
#include <QObject>
#include <QDebug>
/**
 * @brief The CornerStyle enum 声明角型枚举类
 */
enum CornerStyle//定义枚举类
{
    INVERTED_ROUND=0,     //反向圆角
    INVERTED_SQUARE=1,    //反向直角
    MITER=2,              //平角
    ROUND=3,              //圆角
    SQUARE=4              //直角
};
class GY_CONTROLLIBRARY_EXPORT GY_GraphicsCornerStyleRect : public GY_BasicsGraphicsObject
{
    Q_OBJECT
public:
    /**
     * @brief GY_GraphicsCornerStyleRect
     * @param guid
     * @param parent
     */
    explicit Q_INVOKABLE GY_GraphicsCornerStyleRect(const QString &guid,QGraphicsItem *parent = nullptr);
    /**
     * @brief GY_GraphicsCornerStyleRect
     * @param guid
     * @param positionPoint
     * @param sizePoint
     * @param cornerRadius
     * @param parent
     */
    explicit Q_INVOKABLE GY_GraphicsCornerStyleRect(const QString &guid,
                               const QPointF &positionPoint,const QPointF &sizePoint,
                               qreal cornerRadius,
                               QGraphicsItem *parent = nullptr);
    ~GY_GraphicsCornerStyleRect();
private:
    /**
     * @brief m_EnumToMap 从角型枚举映射到map
     */
    QMap<QString,CornerStyle> m_CornerStyleEnumToMap;
    /**
     * @brief updatePositionPoint 更新位置编辑点（默认左下角）
     * @param name
     * @param value
     * @return
     */
    bool updatePositionPoint(const QString &name,const QVariant &value);
    /**
     * @brief updateSizePoint 更新尺寸编辑点（默认右上角）
     * @param name
     * @param value
     * @return
     */
    bool updateSizePoint(const QString &name,const QVariant &value);
    /**
     * @brief updateCornerRadius 更新角型半径大小
     * @param name
     * @param value
     * @return
     */
    bool updateCornerRadius(const QString &name,const QVariant &value);
    /**
     * @brief updateBottomLeftCornerStyle 更新左下角样式
     * @param name
     * @param value
     * @return
     */
    bool updateBottomLeftCornerStyle(const QString &name,const QVariant &value);
    /**
     * @brief updateTopLeftCornerStyle 更新左上角样式
     * @param name
     * @param value
     * @return
     */
    bool updateTopLeftCornerStyle(const QString &name,const QVariant &value);
    /**
     * @brief updateTopRightCornerStyle 更新右上角样式
     * @param name
     * @param value
     * @return
     */
    bool updateTopRightCornerStyle(const QString &name,const QVariant &value);
    /**
     * @brief updateBottomRightCornerStyle 更新右下角样式
     * @param name
     * @param value
     * @return
     */
    bool updateBottomRightCornerStyle(const QString &name,const QVariant &value);
    /**
     * @brief updateBottomLeftCornerStylePath 更新左下角样式图形
     * @param sizePoint
     * @param positionPoint
     * @param cornerRadius
     */
    void updateBottomLeftCornerStylePath(const QPointF &sizePoint,const QPointF &positionPoint,const qreal cornerRadius,const QString &cornerStyle,QPainterPath &path);
    /**
     * @brief updateTopLeftCornerStylePath 更新左上角样式图形
     * @param sizePoint
     * @param positionPoint
     * @param cornerRadius
     */
    void updateTopLeftCornerStylePath(const QPointF &sizePoint,const QPointF &positionPoint,const qreal cornerRadius,const QString &cornerStyle,QPainterPath &path);
    /**
     * @brief updateTopRightCornerStylePath 更新右上角样式图形
     * @param sizePoint
     * @param positionPoint
     * @param cornerRadius
     */
    void updateTopRightCornerStylePath(const QPointF &sizePoint,const QPointF &positionPoint,const qreal cornerRadius,const QString &cornerStyle,QPainterPath &path);
    /**
     * @brief updateBottomRightCornerStylePath 更新右下角样式图形
     * @param sizePoint
     * @param positionPoint
     * @param cornerRadius
     */
    void updateBottomRightCornerStylePath(const QPointF &sizePoint,const QPointF &positionPoint,const qreal cornerRadius,const QString &cornerStyle,QPainterPath &path);
    /**
     * @brief updateDraw 更新矫正后的样式图形
     */
    void updateDraw();
    /**
     * @brief initializationPropertyInfo 初始化属性信息
     */
    void initializationPropertyInfo();
signals:

};

#endif // GY_GRAPHICSCORNERSTYLERECT_H
